﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Threading;

namespace aPCSuite
{
    public partial class Form3 : Form
    {
        private SMSFramework _SMSFramework = new SMSFramework();
        public Form3()
        {
            InitializeComponent();
            _SMSFramework.parent = this;

            txtDateTime.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            this.Refresh();
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void btnOK_Click(object sender, EventArgs e)
        {
            try
            {
                string req = "<protocol encoding=\"UTF-8\" version=\"1.0\">";
                req += "<app_id>1</app_id>";
                req += "<sms_fake>";
                req += "<dev_code>" + aPCSuite.Properties.Settings.Default.dev_code + "</dev_code>";
                req += "<type>" + (radioButton1.Checked ? "2" : "1") + "</type>";
                req += "<address>" + txtTo.Text + "</address>";
                req += "<content>" + richTextBox1.Text + "</content>";
                req += "<create_date>" + txtDateTime.Text + "</create_date>";
                req += "</sms_fake>";
                req += "</protocol>";
                _SMSFramework.srequest = req;
                _SMSFramework.Start();
            }
            catch (System.Exception ex)
            {
                Console.WriteLine("btnOK_Click exception : {0}", ex.Message);
            }
        }
    }
}
